import java.util.Scanner;
import java.util.Stack;


public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        while (in.hasNextLine()) {
            String a = in.nextLine();
            Stack<Character> stc = new Stack<>();
            int len = a.length();
            stc.add(a.charAt(0));
            for(int i = 0; i < len - 1;i++){

                if(!stc.isEmpty() && stc.peek() == a.charAt(i + 1)){
                    stc.pop();
                }else{
                    stc.add(a.charAt(i + 1));
                }
            }
            if(stc.isEmpty()){
                System.out.println(0);
            }else{
                StringBuilder strb = new StringBuilder();
                for(char c : stc){
                    strb.append(c);
                }
                System.out.println(strb.toString());
            }
        }
    }
}